package com.settlement.system.rules;

import com.googlecode.aviator.AviatorEvaluator;
import com.googlecode.aviator.Expression;
import com.settlement.system.model.entity.SysAudit;
import com.settlement.system.model.entity.SysAuditRule;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.Map;

/**
 * 1、无退货退款规则器
 */
public class NoReturnNoRefundRuler implements CommonRuler {
    @Override
    public boolean check(SysAudit sysAudit, SysAuditRule auditRule) {
        // "应收账余额=0
        //且收款金额＞0
        //且退款金额+保证金退款金额≤0
        //且发货金额＞0
        //且退货金额=0"
        return  sysAudit.getReceiveBillAmount().compareTo(BigDecimal.ZERO) == 0 &&
                sysAudit.getReceiveAmount().compareTo(BigDecimal.ZERO) > 0 &&
                sysAudit.getRefundAmount().add(sysAudit.getDepositAmount()).compareTo(BigDecimal.ZERO) <= 0 &&
                sysAudit.getSendAmount().compareTo(BigDecimal.ZERO) > 0 &&
                sysAudit.getReturnAmount().compareTo(BigDecimal.ZERO) == 0;
    }
}
